<template>
	<div>
		   <Card class="content-card">
		  <Tabs :animated="false">
		    <ButtonGroup slot="extra">
				<Button type="primary" size="small" icon="md-refresh" @click="refreshData"></Button>
		    </ButtonGroup>
		    <TabPane label="评估单列表" name="ossessment">
				 <div style="margin-bottom:10px;">
					 <span>状态</span>
					<Select v-model="params.type" style="width:200px;margin-left: 10px;" >
					     	<Option :value="0">待审核</Option>
					     	<Option :value="1">审核通过</Option>
					     	<Option :value="2">审核未通过</Option>
							<Option :value="3">待支付</Option>
							<Option :value="4">待完成</Option>
							<Option :value="5">维修师已评估</Option>
							<Option :value="6">发布者确认</Option>
							<Option :value="7">待退款</Option>
							<Option :value="8">退款完成</Option>
							<Option :value="9">作废</Option>
							
					 </Select>
					 <Button @click="refreshData" type="primary">查询</Button>
				</div>
		        
		            <table-view ref="tableView" :tableCol='tableCol' :params='params' :requestUrl='requestUrl'></table-view>
		    </TabPane>
		  </Tabs>
		</Card>
		<ossessmentOpe ref="ossessmentOpe" :type='modalType' @table='operationDone'></ossessmentOpe>
	</div>
</template>

<script>
	import tableView from '../../components/table'
	import {formatDate} from '../utils/time.js'
	import ossessmentOpe from './ossessmentOpe'
	export default {
	    components:{
	        tableView,
			ossessmentOpe
	    },
	    data(){
	        return {
	            requestUrl:'/ossessment/query/list',
				  ossessmentStatusList:{
				   0:'待审核',1:'审核通过',2:'审核未通过',3:'待支付',4:'待完成',5:'维修师已评估',6:'发布者确认',7:'待退款',8:'退款完成',9:'作废'
				},
	            tableCol:[{
							title: '序号',
							type: 'index',
							width: 80,
							align: 'center'
						},
						{
							title: '评估单号',
							key: 'orderNum',
							minWidth: 120
						},
						{
							title: '车辆信息',
							minWidth: 120,
							render: (h, params) => {
								return h('div', [
									h('img', {
										attrs: {
											src: params.row.car.carPhoto
										},
										style: {
											width: "80px",
											height: "80px",
											margin: "5px"
										}
									}),
									h('div', {
											style: {
												display: "inline-block",
												margin: "40px 0 0 10px",
												position: "absolute"
											}
										},
										params.row.car.carName),
								])
							}
						},
						{
							title: '单价',
							minWidth: 100,
							align: 'center',
							render: (h, params) => {
								return h('div', [
	
									h('div', params.row.car.carMoney+"万元"),
								])
							}
						},
						{
							title: '买家',
							key: 'buyersTel',
							minWidth: 100,
							align: 'center'
						},
						{
							title: '卖家',
							key: 'sellerTel',
							minWidth: 100,
							align: 'center'
						},{
							title: '状态',
							minWidth: 100,
							align: 'center',
							render:(h,params)=>{
							   return h('div',this.ossessmentStatusList[params.row.type])
						   }
						},
						{
							title: '提交日期',
							key: 'createTime',
							minWidth: 100,
							align: 'center',
							render: (h, params) => {
								return h('div', formatDate(new Date(params.row.createTime), 'yyyy-MM-dd hh:mm'))
							}
						},
						{
							title: '操作',
							minWidth: 150,
							 key:'action',
							 render:(h,params)=>{
								 
									  return h('div',[
									     h('Button',{
									         props:{
									             type:'primary',
									             size:'small'
									         },
									         style:{
									             marginLeft:'10px'
									         },
									         on:{
									            click:()=>{
									 			   
												this.$refs['ossessmentOpe'].show(params)
									            }
									         }
									     },'查看详情')
									 ])
							    
							}
						}
					],
	            params:{
	                pageNo:1,
	                pageSize:10,
					type:''
	            },
	            modalType:''
	        }
	    },
		mounted() {
		   
		},
	    methods:{
	        refreshData(){
	            this.$refs['tableView'].getData()
	        },
	        operationDone(){
	            this.$refs['tableView'].getData()
	        }
	    }
	}
</script>

<style>
</style>
